import axios from './axios'
import api from './api'
// 按照axios官方提示需要引入这两步
const CancelToken = axios.CancelToken;
const source = CancelToken.source();
import moment from "moment";

export const listOrderTimeOut = (params) => {
  return axios({
    isDebounce: true,
    url: api.listOrderTimeOut,
    method: 'get',
    params
  })
}

export const countTimeOrder = (params) => {
  return axios({
    isDebounce: true,
    url: api.countTimeOrder,
    method: 'get',
    params
  })
}

export const countComplaintOrder = (params) => {
  return axios({
    isDebounce: true,
    url: api.countComplaintOrder,
    method: 'get',
    params
  })
}

export const orderCount = (params) => {
  return axios({
    showLoading: true,
    url: '/orderCount',
    method: 'get',
    params,
    cancelToken: source.token
  })
}

export const signOrder = (params) => {
  const sendTime = new Date().getTime() || moment().valueOf() || 1
  return axios({
    url: api.signOrder,
    method: 'get',
    params: {
      ...params,
      sendTime: sendTime
    }
  })
}

// 修改订单工单
export const saveWorkOrderModify = (data) => {
  return axios({
    url: api.saveWorkOrderModify,
    method: 'post',
    data: data
  })
}
